def isPerfectNumber(n):
    if n <= 0:
        return False
    factor_sum = 0
    for i in range(1,n//2+1):
        if n % i == 0:
            factor_sum += i
        return factor_sum == n
print(isPerfectNumber(6))